<%@ page language="java" contentType="text/html;charset=UTF-8"%>
<%@ include file="/commons/taglibs.jsp"%>
<%@ include file="/commons/commonEdit.jsp"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>${key.instead_meter}
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</title>
<%@ include file="/commons/validation.jsp"%>
<script language="JavaScript" type="text/javascript"
	src="${ctx}/scripts/ajaxException.js"></script>
<script language="JavaScript" type="text/javascript" src="${ctx}/scripts/public.js"></script>
<script language="JavaScript"  src="${ctx}/scripts/common/prototype.js"></script>
<script language="JavaScript"  src="${ctx}/scripts/div/common.js"></script>
<link href="${ctx}/styles/aux_window.css" rel="stylesheet" type="text/css">
<script type="text/javascript">
var currentDosage = "";

//增加操作
function addCallInPerson(){

	saveCallInPerson("showResponseAdd");

}

//计算本次抄表用量
function countCurrentDosage(lastNumber,maxz){
	//alert(lastNumber);
	var a = $('changesNumer').value;
	if(Number(a) < lastNumber){
		currentDosage = (maxz - lastNumber) + Number(a);
	}else{
		currentDosage = Number(a) - lastNumber;
	}
	$('currentDosage').value=currentDosage;
}

//保存操作,参数为响应结果的方法
function saveCallInPerson(fname){
	var url= "${ctx}/house_meterAction.do?method=changeMeter";
	var pars=$('changeMeterForm').serialize();
	//校验
	var isTure=$("changeMeterForm").fireEvent("onSubmit")
	//ajax提交
	if(isTure){
		var myAjax = new Ajax.Request(
	                    url,
	                    {method: 'post', parameters: pars, onComplete: eval( fname )}
	                    );
	}
}
//保存操作的响应
function showResponseAdd(result){

ajaxSubmitException(result.responseText);
  if(result.responseText == 'true'){
	var obj=findFrame("HouseMeterEdits");
	obj.flush();
	windowClose();
	}else{
	alert(result.responseText);
	}
}



</script>


</head>

<body>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td class="window_head_outBg"><table border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td width="121"><img src="${ctx}/images/ico_Advance.gif" width="16" height="16" align="absmiddle"><span class="window_head_intext">${key.instead_meter}</span></td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td class="aux_header_line_1"></td>
  </tr>
  <tr>
    <td class="aux_header_line_2"></td>
  </tr>
  <tr>
    <td class="content"><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td class="aux_outtable_color"><table width="100%" border="0" cellpadding="0" cellspacing="1" class="aux_intable_color">
		<form id="changeMeterForm" name="changeMeterForm" method="post" action="${ctx}/house_meterAction.do?method=changeMeter" class="required-validate">
         <input type="hidden" name="oldKeyword" value="${oldMeterVO.keyword}">
         <input type="hidden" name="houseId" value="${oldMeterVO.houseId}">
          <tr>
            <td class="aux_intable_td1">${key.meter_name}</td>
            <td class="aux_intable_td2">${oldMeterVO.name}</td>
          </tr>


          <tr>
            <td class="aux_intable_td1">${key.last_number}</td>
            <td class="aux_intable_td2">${oldMeterVO.lastNumer} ${key.du}</td>
          </tr>
		  <tr>
            <td class="aux_intable_td1">${key.changes_number}</td>
            <td class="aux_intable_require"><input name="changesNumer"  type="text"
            class="required validate-pattern-/^(0|([1-9]\d{0,9}))(\.\d{1,2})?$/g max-value-${oldMeterVO.MAXZ}"
            onblur="countCurrentDosage('${oldMeterVO.lastNumer}','${oldMeterVO.MAXZ}');"
            value="${oldMeterVO.changesNumer}" style="text-align:right" size="16" maxlength="13">
               ${key.du}</td>
          </tr>


          <tr>
            <td class="aux_intable_td1">${key.current_dosage}</td>
            <td class="aux_intable_require"><input name="currentDosage"  type="text" class="required"  value="" readonly="readonly" style="text-align:right" size="16"> ${key.du}</td>
          </tr>

          <tr>
            <td class="aux_intable_td1">${key.new_meter_name}</td>
            <td class="aux_intable_td2">${meterVO.name}</td>
          </tr>
          <tr>
            <td class="aux_intable_td1">${key.new_meter_base}</td>
            <td class="aux_intable_require"><input name="base" value="" type="text"
            class="required validate-pattern-/^(0|([1-9]\d{0,9}))(\.\d{1,2})?$/g max-value-${oldMeterVO.MAXZ}"
            style="text-align:right"
            size="16" maxlength="13">
             ${key.du}
              </td>
          </tr>


        </table></td>
      </tr>
    </table></td>
  </tr>
  </form>
  <tr>
   <td class="window_footer"><table border="0" align="right" cellpadding="0" cellspacing="0">
        <tr>
          <td><table border="0" cellpadding="0" cellspacing="0">

          </table></td>
		  <td class="btn_between_space"></td>
          <td><table border="0" cellpadding="0" cellspacing="0" >
            <tr>
              <td class="buttonOffLeft" id="btn1_51"></td>
              <td class="buttonOffMiddle" id="btn1_52" onblur="btn_change(5)" onMouseOver="btn_change_over(5)" onMouseOut="btn_change_out(5)" onClick="addCallInPerson();"><img src="${ctx}/images/ico_ok.gif" border="0" align="absmiddle" /> ${key.save}</td>
              <td class="buttonOffRight" id="btn1_53"></td>
            </tr>
        </table></td>
        <td class="btn_between_space"></td>
        <td><table border="0" cellpadding="0" cellspacing="0">
            <tr>
              <td class="buttonOffLeft" id="btn1_31"></td>
              <td class="buttonOffMiddle" id="btn1_32" onblur="btn_change(3)"  onClick="windowClose();" onMouseOver="btn_change_over(3)" onMouseOut="btn_change_out(3)"><img src="${ctx}/images/ico_cancel.gif" border="0" align="absmiddle" />${key.close}</td>
              <td class="buttonOffRight" id="btn1_33"></td>
            </tr>
        </table></td>
      </tr>
    </table></td>
  </tr>
</table>
</body>
</html>